package com.groot.common.util;

import java.util.UUID;

public class TicketUtil {
	/**
	 * 发票号
	 * @return
	 */
	public static String getDefaultFapiao(){
		StringBuffer fp = new StringBuffer();
		fp.append("PAY_");
		fp.append(getUUID().substring(0, 4));
		String tmp = timeStep();
		int idx = tmp.length() - 8;
		fp.append(tmp.substring(idx));
		return fp.toString().toUpperCase();
	}
	/**
	 * 慢性病证号
	 * @return
	 */
	public static String getDefaultChronic(){
		StringBuffer fp = new StringBuffer();
		fp.append("chronic");
		fp.append(getUUID().substring(0, 4));
		String tmp = timeStep();
		int idx = tmp.length() - 8;
		fp.append(tmp.substring(idx));
		return fp.toString().toUpperCase();
	}
	public static String getUUID(){
		return UUID.randomUUID().toString().replaceAll("-", "");
	}
	
	public static String timeStep(){
		return String.valueOf(System.currentTimeMillis());
	}
}
